package com.tungse.study.activiti;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.DeploymentBuilder;

public class Demo1_ProcessTest {


    public static void main(String[] args) {
        //将请假流程图以及流程文件部署到activiti中

        // 1. 创建流程引擎对象
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        // 2. 获取repository  service api 对象
        RepositoryService repositoryService = processEngine.getRepositoryService();
        // 3. 创建部署对象， 配置部署信息
        DeploymentBuilder deployment = repositoryService.createDeployment();
        deployment.addClasspathResource("bpmn/test-bpmn.bpmn.bpmn")
                .name("请假流程");
        // 4. 执行部署操作
        Deployment deploy = deployment.deploy();

        System.out.println("部署id:" + deploy.getId());
        System.out.println("部署name:" + deploy.getName());
        System.out.println("部署key:" + deploy.getKey());

    }
}
